Atomicity, Consistency, Isolation, and Durability (ACID) are a set of four guarantees that relational databases provide to ensure data reliability and consistency during transactions. Transactions are groups of operations treated as a single unit.
- Atomicity: All the operations within a transaction can't be divided. Either all changes succeed, or none do. This prevents the database from ending up in an inconsistent state due to partial updates. Imagine transferring money between accounts - both accounts must be updated successfully, or neither.
- Consistency: A transaction transforms the database from one valid state to another. The database rules and constraints are enforced to maintain data integrity and prevent inconsistencies.
- Isolation: The database keeps transactions separate to ensure that the results of one transaction don't affect another until the first one is finished. This practice avoids conflicts and unpredictable outcomes.
- Durability: Once a transaction is completed, the changes are permanently stored. Even if a system failure occurs, the database guarantees that the data won't be lost.